<template>
  <div class="bigScreen">
    <iframe
      width="1080"
      height="1920"
      class="iframeSty"
      :src="url"
      frameborder="0"
    ></iframe>
  </div>
</template>
<script>
export default {
  name: "bigScreen",
  data() {
    return {
      url: "",
    };
  },
  beforeDestroy() {
    var viewport = document.querySelector("meta[name=viewport]");
    viewport.setAttribute(
      "content",
      "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,user-scalable=no"
    );
  },
  mounted() {
    var viewport = document.querySelector("meta[name=viewport]");
    if (window.devicePixelRatio == 1) {
      viewport.setAttribute(
        "content",
        "width=device-width,initial-scale=1, minimum-scale=1, user-scalable=yes"
      );
    } else if (window.devicePixelRatio == 2) {
      viewport.setAttribute(
        "content",
        "width=device-width,initial-scale=1, minimum-scale=0.5, user-scalable=yes"
      );
    } else if (window.devicePixelRatio == 3) {
      viewport.setAttribute(
        "content",
        "width=device-width,initial-scale=1, minimum-scale=0.3333333333333333, user-scalable=yes"
      );
    } else {
      const scaleNum = 1 / window.devicePixelRatio;
      viewport.setAttribute(
        "content",
        `width=device-width,initial-scale=1, minimum-scale=${scaleNum}, user-scalable=yes`
      );
    }
    let baseUrl = window.location.hostname;
    let storeId = localStorage.getItem("storeId");
    if (
      baseUrl.indexOf("staging") != -1 ||
      baseUrl.indexOf("localhost") != -1
    ) {
      this.url = `https://staging-admin.huoxingy.com/#/sys/${storeId}/bigScreenFrontEnd`;
    } else {
      this.url = `https://admin.huoxingy.com/#/sys/${storeId}/bigScreenFrontEnd`;
    }
  },
};
</script>
<style lang="scss" scoped>
.bigScreen {
  width: 1080px;
  height: 1920px;
}
</style>